<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <input v-model="num1" type="text">
  <input v-model="num2" type="text">
  <input type="button"value="+" @click="f('+')">
  <input type="button"value="-" @click="f('-')">
  <input type="button"value="*" @click="f('*')">
  <input type="button"value="/" @click="f('/')">
  <h1>结果:{{info}}</h1>
</div>
<script src="../js/vue.js"></script>
<script>
  let v = new Vue({
            el: "div",
            data: {
              num1: "",
              num2: "",
              info: "",
            },
            methods: {
              f(x) {
                //eval()方法可以将字符串以代码的形式执行
                v.info = eval(v.num1+x+v.num2);
              }
            }
          }
  )
</script>
</body>
</html>